home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_2 / hp48_ir < prev    next >
Internet Message Format  |  1995-03-31  |  8KB

  1. From comp.sys.hp48 Sun Aug 11 20:26:51 1991
  2. Path: seq!ecsgate!mcnc!uvaarpa!haven.umd.edu!purdue!sample.eng.ohio-state.edu!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!jpl-devvax!puente!garyf
  3. From: garyf@puente.jpl.nasa.gov (Gary Friedman)
  4. Newsgroups: comp.sys.hp48
  5. Subject: Infrared Remote Control Learn/Transmit Source Code for the HP48
  6. Summary: Direct from the Corvallis conference proceedings
  7. Keywords: IR, remote, learning, infrared, world is drooling over this...
  8. Message-ID: <1991Aug9.182627.2019@jpl-devvax.jpl.nasa.gov>
  9. Date: 9 Aug 91 18:26:27 GMT
  10. References: <1991Jul31.215836.12760@panix.com> <1991Aug02.003032.6618@corpane.uucp> <17365@life.ai.mit.edu>
  11. Sender: usenet@jpl-devvax.jpl.nasa.gov (For NNTP so rrn will be able to post)
  12. Distribution: comp.sys.handhelds, comp.sys.hp48
  13. Organization: Jet Propulsion Laboratory, Advanced Engineering Group
  14. Lines: 219
  15.  
  16.  
  17. Okay, okay!  Here is the article on the IR Remote control for the 48!!!!
  18.  
  19. Remember, this was literally the first cut, and there is gobs of room
  20. for improvment and polishing!
  21.  
  22. Enjoy!
  23.                         -Gary Friedman
  24.  
  25. ------------------------------------------------------------------
  26.  
  27.  
  28.             IR Sampling of TV Remotes
  29.  
  30.          by Dave Marsh  (Typed in by Gary Friedman)
  31.  
  32.  
  33. Many users have experimented with the HP 48 to make it capable of 
  34. being a TV remote control unit.  With its built-in IR capability
  35. numerous schemes have been tried to give the HP 48 additional power.
  36. Previously these schemes involved knowing the digital codes used to
  37. modulate the 40 KHz IR signal commonly used.
  38.  
  39. With the recent release by HP of their Software Development Tools it
  40. is possible to write assembly programs for the HP 48.  Faster speed
  41. and greater control of the calculator are gained using this approach.
  42.  
  43. A method that occurred to me during lunch one day - I do development
  44. work on the HP 48 as part of my job - is implemented in the two
  45. programs on the following pages.  The basic idea is to sample the
  46. incoming IR as fast as possible to digitize the signal and record it.
  47. This takes lots of memory, but it actually works.  Using this method
  48. of "learning" the codes instead of knowing them allows the HP 48 to
  49. be used by any IR device.  The inverse is used with the second program
  50. using the stored sampled signal (stored as a text string) to control
  51. the transmitter.
  52.  
  53. This approach is still in the experimental stages and there is much
  54. work to be done.  Applications include controlling systems such as the
  55. BSR system that has in IR controller - at least they used to offer an
  56. IR controller.  Your HP 48 could, with off-the-shelf components and a
  57. simple program, control the lights and appliances of your home or
  58. factory.
  59.  
  60. The sampling rate is estimated at about 60 kilohertz, still short of
  61. the desired twice the carrier frequency.  Still it works quite well.
  62. I have written preliminary programs that convert the digitized signal
  63. into a graphics object that may be displayed or printed.  This aids
  64. the decoding of the signal if that is of interest.  
  65.  
  66. Once the optimum signal is determined it may be stored in a more
  67. memory-efficient form.  A complete set of commands for any IR
  68. controller could be made available to any user.  This aspect of the
  69. programming ahs yet to be done.  Copies of the program will be
  70. available at the conference and time does not allow a complete
  71. description of the program here.  The listings are commented and there
  72. is always room for improvement.  One problem is the memory usage of
  73. using one nibble where only one bit is needed.  Perhaps other
  74. programmers will find additional techniques to make the program
  75. faster.
  76.  
  77.  
  78.     Dave Marsh
  79.     18335 Jakes Way #103
  80.     Canyon Country, CA 91351
  81.     (818) 362-6822 x3007 (W)
  82.  
  83. [Poster's note: I will try to post an ASC-> version of the binary this
  84. weekend.   -GF]
  85.  
  86. -----------------------------------------------------------------
  87.  
  88. *    LOOK
  89. *    A PROGRAM TO SAMPLE I.R. REMOTE CONTROL SIGNALS
  90. *
  91. *    1:    STRING ->    1:    STRING
  92. *
  93. *    (C) 1991 DAVE MARSH - THIS PROGRAM MAY BE DISTRIBUTED ONLY IF
  94. *    IT'S FREE OF CHARGE
  95. *
  96. *    (Insert your favorite disclaimers here)
  97. *
  98.  ASSEMBLE
  99.  
  100.     NIBASC  \HPHP48-F\
  101.  
  102.     RPL
  103.     ::
  104.     CK1NOLASTWD            ( CHECK FOR 1 ARG )
  105.     CK&DISPATCH1        ( CHECK ARG IS STRING )
  106.     THREE
  107.     ::
  108.     TOTEMPOB
  109.     CODE
  110.       GOSBVL #01115        DisableIntr (FOR SMOOTH INPUT)
  111.       INTOFF
  112.       A=DAT1 A            SET A TO POINT AT BEGINNING OF STRING
  113.       GOSBVL #0679B        SAVE REGISTERS (SAVEPTR)
  114.  
  115.       D1=HEX #0011A        11Ah IS ADDRESS OF I.R. INPUT
  116.       P= 0
  117.       C=0 P
  118.       DAT1=C P            SET 'TRIGGERED' BIT TO 0
  119.  
  120.       D0=A                
  121.       D0=D0+ 5            D0 POINTS TO LENGTH FIELD OF STRING
  122.       C=DAT0 A
  123.       C=C-CON A, 5        SUBTRACT 5 FROM LENGTH IN ORDER TO GET 
  124.                 DATA LENGTH ONLY
  125.       D0=D0+ 5            D0 POINTS TO DATA AREA OF STRING
  126.  
  127.       A=A+CON A, 10        SET A = D0
  128.       C=C+A A            SET C= ADDRESS OF END OF STRING
  129.       B=A A                
  130.  
  131. LOOP1 A=DAT1 P            LOOP UNTIL TRIGGER BIT IS 1 (I.R. SIGNAL REC'D)
  132.       ?ABIT=0 0            
  133.       GOYES LOOP1
  134.  
  135. LOOP2 A=DAT1 P            GET I.R. DATA AND STORE AS NIBBLE OF STRING
  136.       DAT0=A P
  137.       D0=D0+ 1
  138.       B=B+1 A
  139.       ?B#C A            LOOP UNTIL D0=END OF STRING (STORAGE AREA)
  140.       GOYES LOOP2
  141.  
  142.      GOSBVL #010E5        AllowIntr ( re-enable interrupts )
  143.  
  144.      GOVLNG #05143        RESTORE REGISTERS (GETPTRLOOP)
  145.    ENDCODE
  146.     ;
  147.    ;
  148.  
  149.  
  150. ------------------------------------------------------------------
  151.  
  152. *    XMITREM
  153. *    A PROGRAM TO EMULATE AN I.R. REMOTE CONTROL TRANSMISSION
  154. *    REQUIRES OUTPUT OF 'LOOK' PROGRAM AS INPUT
  155. *
  156. *
  157. *    1:   STRING ->  EMPTY STACK
  158. *
  159. *
  160. *    (C) 1991 DAVE MARSH- THIS PROGRAM MAY BE DISTRIBUTED ONLY IF 
  161. *    IT'S FREE OF CHARGE
  162. *
  163. *
  164.  
  165. ASSEMBLE
  166.  
  167.    NIBASC \HPHP48-F\
  168.  
  169.    RPL
  170.    ::
  171.    CK1NOLASTWD
  172.    CK&DISPATCH1            ( CHECK FOR 1 ARG- STRING )
  173.    THREE
  174.    ::
  175.    TOTEMPOB            ( MAKE NEW COPY OF STRING IN TEMPORARY MEMORY )
  176.    CODE
  177.      GOSBVL #01115        DisableIntr (FOR SMOOTH TRANSMISSION)
  178.      INTOFF
  179.  
  180.      A=DAT1 A            A POINTS TO INPUT STRING (OUTPUT FROM LOOK)
  181.      D1=D1+ 5            
  182.      D=D+1 A
  183.      GOSBVL #0679B        SAVEPTR
  184.  
  185.      P= 0
  186.      C=0 P
  187.      D1=HEX #0011A        11Ah IS ADDRESS OF I.R. INPUT & CONTROL
  188.      DAT1=C P            SET IR CONTROL BITS TO 0
  189.  
  190.      D0=A
  191.      D0=D0+ 5            D0 POINTS TO LENGTH FIELD OF STRING
  192.      D1=HEX #0011C        11Ch IS ADDRESS OF I.R. LED CONTROL (BIT 3)
  193.      DAT1=C P            MAKE SURE LED IS OFF
  194.  
  195.      C=DAT0 A
  196.      C=C-CON A, 5        C IS LENGTH OF DATA STRING ONLY
  197.      D0=D0+ 5            D0 POINTS TO DATA FIELD OF STRING
  198.  
  199.      A=A+CON A, 10        SET A = D0
  200.      C=C+A A              SET C= ADDRESS OF END OF STRING
  201.      B=A A
  202.      R1=A
  203.  
  204. LOOP2 A=DAT0 P
  205.      A=A-1 P        SUBTRACT 1 FROM NIBBLE (FORMS BIT 3 ON OR NOTHING)
  206.      DAT0=A P            AND PUT BACK
  207.      D0=D0+ 1            INCREMENT NEXT NIBBLE
  208.      B=B+1 A            
  209.      ?B#C A            LOOP UNTIL END OF STRING
  210.      GOYES LOOP2
  211.  
  212.      A=R1
  213.      B=A A
  214.      D0=A A
  215. LOOP3 A=DAT0 P
  216.      DAT1=A P            SEND DATA TO LED (OFF OR ON)
  217.      D0=D0+ 1            INCREMENT TO NEXT NIBBLE
  218.      B=B+1 A            
  219.      ?B#C A            LOOP UNTIL END OF STRING
  220.      GOYES LOOP3
  221.  
  222.      A=0 P            MAKE SURE LED IS OFF
  223.      DAT1=A P
  224.  
  225.      GOSBVL #010E5        RESTORE INTERRUPTS
  226.  
  227.      GOVLNG #05143        GETPTRLOOP
  228.   ENDCODE
  229.   ;
  230. --
  231. ----------------------------------------------------------------
  232. Gary Friedman                   Jet Propulsion Laboratory - NASA
  233. 4800 Oak Grove Drive, Pasadena, CA.  91109        (818) 354-1447
  234. garyf@puente.JPL.NASA.GOV || {cit-vax,elroy,psivax}!devvax!garyf 
  235.  
  236.